//
// Created by Mayn on 25-7-13.
//

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSplitter>

#include "ViewState.h"
#include "TopGLWidget.h"
#include "BottomGLWidget.h"
class MainWindow : public QMainWindow {
public:
    MainWindow(QWidget* parent = nullptr) : QMainWindow(parent) {
        // 创建共享视图状态
        m_viewState = new ViewState();

        // 创建分割器
        QSplitter* splitter = new QSplitter(Qt::Vertical, this);

        // 创建顶部标尺视图
        TopGLWidget* topWidget = new TopGLWidget(m_viewState, splitter);
        topWidget->setMinimumSize(400, 200);

        // 创建底部瀑布图视图
        BottomGLWidget* bottomWidget = new BottomGLWidget(m_viewState, splitter);
        bottomWidget->setMinimumSize(400, 200);

        // 添加到分割器
        splitter->addWidget(topWidget);
        splitter->addWidget(bottomWidget);

        // 设置初始大小比例
        splitter->setSizes({400, 400});

        setCentralWidget(splitter);
        resize(1200, 800); // 更大的初始窗口
        setWindowTitle("高性能OpenGL瀑布图");
    }

private:
    ViewState* m_viewState;
};

#endif //MAINWINDOW_H
